home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWPart / FWDrgDrp.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  5.4 KB  |  186 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWDrgDrp.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWDRGDRP_H
  11. #define FWDRGDRP_H
  12.  
  13. // ----- Foundation Includes -----
  14.  
  15. #ifndef FWSTDDEF_H
  16. #include "FWStdDef.h"
  17. #endif
  18.  
  19. #ifndef FWRUNTYP_H
  20. #include "FWRunTyp.h"
  21. #endif
  22.  
  23. // ----- OpenDoc Includes -----
  24.  
  25. #ifndef FWODTYPS_H
  26. #include "FWODTyps.h"
  27. #endif
  28.  
  29. #ifndef SOM_ODFacet_xh
  30. #include <Facet.xh>
  31. #endif
  32.  
  33. //========================================================================================
  34. //    Forward Declarations
  35. //========================================================================================
  36.  
  37. class FW_CPart;
  38. class FW_CView;
  39. class FW_CFrame;
  40. class FW_CMouseEvent;
  41. class FW_CPoint;
  42. class FW_CDragCommand;
  43. class FW_CDropCommand;
  44. class FW_CDropTracker;
  45.  
  46. //========================================================================================
  47. //    Constants
  48. //========================================================================================
  49.  
  50. typedef short FW_DroppableState;
  51.  
  52. const FW_DroppableState FW_kNotDroppable         = 0x0;
  53. const FW_DroppableState FW_kFrameDroppable         = 0x1;
  54. const FW_DroppableState FW_kThumbnailDroppable    = 0x2;
  55. const FW_DroppableState FW_kIconDroppable         = 0x4;
  56.  
  57. //========================================================================================
  58. //     class FW_MDraggableFrame
  59. //========================================================================================
  60.  
  61. class FW_MDraggableFrame
  62. {
  63. public:
  64.     FW_DECLARE_CLASS
  65.  
  66. //----------------------------------------------------------------------------------------
  67. //    Constructor/Destructors
  68. //
  69. protected:
  70.     FW_MDraggableFrame(Environment *ev, FW_CFrame* frame);
  71.  
  72. public:
  73.     virtual ~ FW_MDraggableFrame();
  74.     
  75. //----------------------------------------------------------------------------------------
  76. //    New API
  77. //
  78. public:
  79.     virtual FW_CDragCommand*     NewDragCommand(Environment *ev, 
  80.                                     FW_CFrame* theFrame,
  81.                                     const FW_CMouseEvent& theMouseEvent) = 0;
  82.         //     You should create an instance of FW_CDragCommand (or a subclass of FW_CDragCommand)
  83.         //    Don't forget that if your part support embedding this action must be undoable.
  84.  
  85. //----------------------------------------------------------------------------------------
  86. //    New API unlikely to be overriden
  87. //
  88. public:
  89.     virtual FW_Boolean            Drag(Environment* ev, 
  90.                                     const FW_CMouseEvent& theMouseEvent);
  91.  
  92. //----------------------------------------------------------------------------------------
  93. //    Data Members 
  94. //
  95. private:
  96.     FW_CPart*                    fPart;
  97.     FW_CFrame*                    fFrame;
  98. };
  99.  
  100. //========================================================================================
  101. //     class FW_MDroppableFrame
  102. //========================================================================================
  103.  
  104. class FW_MDroppableFrame
  105. {
  106. public:
  107.     FW_DECLARE_CLASS
  108.  
  109. //----------------------------------------------------------------------------------------
  110. //    Constructor/Destructors
  111. //
  112. protected:
  113.     FW_MDroppableFrame(Environment *ev, FW_CFrame* frame);
  114.  
  115. public:
  116.     virtual ~ FW_MDroppableFrame();
  117.     
  118. //----------------------------------------------------------------------------------------
  119. //    New API
  120. //
  121. public:
  122.     virtual FW_CDropCommand*     NewDropCommand(Environment *ev, 
  123.                                     FW_CFrame* frame,
  124.                                     ODDragItemIterator* dropInfo, 
  125.                                     ODFacet* facet, 
  126.                                     const FW_CPoint& dropPoint) = 0;
  127.         //     You should create an instance of FW_CDropCommand (or a subclass of FW_CDropCommand)
  128.         //    Don't forget that if your part support embedding this action must be undoable.
  129.  
  130.     virtual ODDropResult         Drop(Environment *ev, 
  131.                                     ODDragItemIterator* dropInfo,
  132.                                     ODFacet* facet, const FW_CPoint& where);
  133.     
  134.     virtual ODDragResult        CanAcceptDrop(Environment* ev, 
  135.                                         ODDragItemIterator* dragInfo);
  136.     
  137.     virtual ODDragResult        DragEnter(Environment* ev, 
  138.                                         ODFacet* facet, 
  139.                                         ODDragItemIterator* dragInfo, 
  140.                                         const FW_CPoint& where);
  141.                                         
  142.     virtual ODDragResult        DragWithin(Environment* ev, 
  143.                                         ODFacet* facet, 
  144.                                         ODDragItemIterator* dragInfo, 
  145.                                         const FW_CPoint& where);
  146.                                         
  147.     virtual void                 DragLeave(Environment* ev, 
  148.                                         ODFacet* facet, 
  149.                                         const FW_CPoint& where);
  150.  
  151.     // ----- Drag hilite -----
  152.      virtual ODShape*             AcquireDragHiliteShape(Environment* ev, ODFacet* facet);
  153.     
  154.  
  155.     virtual FW_CDropTracker*    NewDropTracker(Environment* ev, FW_CView* view, ODFacet* facet);
  156.     
  157. //----------------------------------------------------------------------------------------
  158. //    Getters/Setters
  159. //
  160. public:
  161.     FW_Boolean                    GetCanAcceptDrop(Environment* ev) const;
  162.     
  163.     FW_CDropTracker*            GetDropTracker(Environment* ev) const;
  164.         
  165.     virtual void                ChangeDroppableState(Environment* ev, FW_DroppableState droppable);
  166.     FW_DroppableState            GetDroppableState(Environment* ev) const;
  167.     
  168. //----------------------------------------------------------------------------------------
  169. //    Implementation Only API
  170. //
  171. public:
  172.     FW_Boolean                    PrivIsDroppable(Environment* ev) const;
  173.     static FW_Boolean            PrivDroppableStateToBoolean(FW_DroppableState droppable, ODTypeToken viewType);
  174.  
  175. //----------------------------------------------------------------------------------------
  176. //    Data Members 
  177. //
  178. private:
  179.     FW_CPart*                    fPart;
  180.     FW_CFrame*                    fFrame;
  181.     FW_Boolean                    fCursorInContent;
  182.     FW_Boolean                    fCanAcceptDrop;
  183.     FW_CDropTracker*            fDropTracker;
  184. };
  185.  
  186. #endif